package com.shanghaiyimu.yimiyangche.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import com.shanghaiyimu.yimiyangche.R;
import com.shanghaiyimu.yimiyangche.adapter.THjiangjiaAdapter;
import com.shanghaiyimu.yimiyangche.bean.CarBeen;

import java.util.ArrayList;
import java.util.List;

public class THJiangjiaActivity extends AppCompatActivity {
    private ListView mListView;
    private THjiangjiaAdapter adapter;
    private List<CarBeen> datas = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_thjiangjia);
        initView();
        initData();
    }

    private void initData() {
        for (int i = 0; i < 16; i++) {
            CarBeen carBeen = new CarBeen();
            carBeen.setName("保时捷2017 - 2017款 6.0T Robot"+i);
            carBeen.setPrice(5482.60+10*i);
            datas.add(carBeen);
        }
        adapter.notifyDataSetChanged();

    }

    private void initView() {
        mListView = (ListView) findViewById(R.id.jiangjiapaihang_lv);
        adapter = new THjiangjiaAdapter(this,datas);
        mListView.setAdapter(adapter);
    }
}
